<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %> 
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<html>
<head>
	<title><s:text name="pl.grabar.clinic.client.web.reception.patient.views.schedule-visit"/></title>
	<sj:head jqueryui="true" jquerytheme="flick" locale="%{locale}"/>
	<script type="text/javascript">
	 	function createObjectActionsRow(cellvalue, options, row) {
	 		return "<a href='start?visitId=" + cellvalue + "'><s:text name='pl.grabar.clinic.client.web.buttons.start'/></a>"
	 				+ "&nbsp;&nbsp;<a href='delete?visitId=" + cellvalue + "'><s:text name='pl.grabar.clinic.client.web.buttons.delete'/></a>"
	 				+ "&nbsp;&nbsp;<a href='preview?visitId=" + cellvalue + "'><s:text name='pl.grabar.clinic.client.web.buttons.preview'/></a>"
		}
	 	function createDoctorFullName(cellvalue, options, row){
	 		return cellvalue.firstName +" "+ cellvalue.lastName;
	 	}
	 	function createPatientFullName(cellvalue, options, row){
	 		if(cellvalue == null){
	 			return ;
	 		}
	 		return cellvalue.firstName +" "+ cellvalue.lastName +" - "+ cellvalue.pesel;
	 	}
	</script>
	<style type="text/css">
	#demo{
    z-index: 15;
    position: relative;

}
	</style>
</head>
<body>
	<h1><s:text name="pl.grabar.clinic.client.web.reception.patient.views.schedule-visit"/></h1>
	
	<s:url var="loadUrl" action="load"/>
	    <sjg:grid
		        id="gridtable"
		        dataType="json"
		        href="%{loadUrl}"
		        pager="true"
		        gridModel="data"
		        rowList="10,20,50,100"
		        rowNum="15"
		        rownumbers="true"
		        sortorder="asc"
		        autowidth="true"
		        shrinkToFit="true">
        <sjg:gridColumn name="visitDate" title="%{getText('pl.grabar.clinic.client.web.labels.visit-date')}" formatter="date" formatoptions="{newformat : 'd-m-Y - H:i', srcformat : 'Y-m-d H:i:s'}" sortable="false"/>
        <sjg:gridColumn name="patient" title="%{getText('pl.grabar.clinic.client.web.labels.patient-full-name')}" formatter="createPatientFullName" sortable="false"/>
        <sjg:gridColumn name="doctor" title="%{getText('pl.grabar.clinic.client.web.labels.doactor-full-name')}" formatter="createDoctorFullName" sortable="false"/>
        <sjg:gridColumn name="id" title="%{getText('pl.grabar.clinic.client.web.labels.actions')}" sortable="false" formatter="createObjectActionsRow" width="80"/>
	    </sjg:grid>
    
<%--     <input type="button" onclick="location.href='new'" value="<s:text name='pl.grabar.clinic.client.web.buttons.add'/>"> --%>
</body>
</html>